package com.p900.website.service;

import com.p900.commons.domain.Product;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;

import java.util.List;

/**
 * Created by lenovo on 2015/5/2.
 */
public interface ProductService {

    /**
     * 根据id查产品
     * @param id
     * @return
     */
    public Product findProduct(Long id);

    /**
     * 根据平台id查产品列表
     * @param platformId
     * @param pageable
     * @return
     */
    public Page<Product> findByPlatformId(Long platformId, Pageable pageable);

    /**
     * 查询热门商品
     * @param pageable
     * @return
     */
    public Page<Product> findHotProducts(Pageable pageable);

    /**
     * 搜索商品
     * @param key
     * @param pageable
     * @return
     */
    public Page<Product> searchProducts(String key, Pageable pageable);

    /**
     * 保存商品
     * @param product
     * @return
     */
    public Product save(Product product);

    /**
     * 删除商品
     * @param id
     */
    public void delete(Long id);
}
